package bishizhuanyong.美团;

import java.util.Arrays;
import java.util.Scanner;

public class meituan5 {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n = s.nextInt();
        int[] a=new int[n];
        int[] b=new int[n];
        int[] c=new int[n];
        for (int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for (int i=0;i<n;i++){
            b[i]=s.nextInt();
        }
        for (int i=0;i<n;i++){
            b[i]=s.nextInt();
        }
        Arrays.sort(a);
        Arrays.sort(b);
        Arrays.sort(c);
        process(a,b,c,0,1);
        System.out.println(count);
    }
    public static int count=0;
    public static void process(int[] a,int[] b,int[] c,int lastDiff,int curPos){
        if (curPos==4) {
            count++;
            return;
        }
        if (curPos==1){
            for (int i=0;i<a.length;i++)
                process(a,b,c,a[i],curPos+1);
            return;
        }
        if (curPos==2){
            for (int i=0;i<b.length;i++){
                if (b[i]>lastDiff*2)
                    return;
                if (b[i]>lastDiff&&b[i]<=lastDiff*2)
                    process(a,b,c,b[i],curPos+1);
            }
            return;
        }
        if (curPos==3){
            for (int i=0;i<c.length;i++){
                if (c[i]>lastDiff*2)
                    return;
                if (c[i]>lastDiff&&c[i]<=lastDiff*2)
                    process(a,b,c,c[i],curPos+1);
            }
            return;
        }
    }
}
